package com.soccerlover9527.jadis.util;

import java.util.List;

/**
 * <p></p>
 *
 * @author soccerlover9527@gmail.com
 * @since 2023-09-14
 */
public class PrintUtil {

    /**
     * print list to string with comma
     * @param list list
     * @return string
     */
    public static String printList(List<?> list) {
        StringBuilder builder = new StringBuilder();
        var listIterator = list.listIterator();
        while (listIterator.hasNext()) {
            builder.append(listIterator.next());
            if (listIterator.hasNext()) {
                builder.append(",");
            }
        }
        return builder.toString();
    }
}
